//
//  MYGShareManagerCell.swift
//  MYDoctor
//
//  Created by Denny on 2024/4/24.
//

import UIKit

class MYGShareManagerCell: UICollectionViewCell {
    var avatar: UIImageView = {
        let control = UIImageView()
        control.contentMode = .scaleAspectFill
        control.layer.cornerRadius = 25 
        control.layer.masksToBounds = true
        return control
    }()
    
    var model = MYGShareMangerUserModel()
    var nameLB:UILabel = {
        let control = UILabel()
        control.textColor = UIColor.init(hexString: "#262626")
        control.font = .regular(13)
        control.textAlignment = .center
        return control
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        addSubview(avatar)
        avatar.snp.makeConstraints { make in
            make.size.equalTo(CGSize.init(width: 50, height: 50))
            make.top.equalToSuperview()
            make.centerX.equalToSuperview()
        }
        
        addSubview(nameLB)
        nameLB.snp.makeConstraints { make in
            make.top.equalTo(avatar.snp.bottom).offset(5)
            make.centerX.equalToSuperview()
        }
    }
    
    func bindData(_ data: MYGShareMangerUserModel) {
        self.model = data
        self.avatar.sd_setImage(with: URL(string: data.avatar), placeholderImage: UIImage.init(named: "head"), context: nil)
        self.nameLB.text = data.name
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
